package moa.sequencestreams.generator;

import moa.sequencestreams.generator.StringSet;

public class ArrayString {
	int nitems;	// number of items
	int[] items;  // list of the items
	//  FLOAT *rval;	// random value (used to get random ordering of the items)
	//  Item *ritems;	// randomly chosen items
	float prob;	// probability that this string is chosen
	float conf;	// probability that this string is corrrupted
	
	public ArrayString(int n)
	{
		nitems = n;
		items = new int [nitems];
	}
	

	public	  int size() { return nitems;}
	public	  int item(int n) { return items[n];} // return nth item of the string
	public	  float conf_lvl() { return conf; }

	public	  void set_size(int newsize) { nitems = newsize;}
	public	  void set_item(int n, int itm) { items[n] = itm;}
	public	  void set_conf_lvl(float newconf) { conf = newconf; }
	
	public void display(int prob_comp)
	{
	  //fp << setw(6) << prob_comp * prob << " " << setw(6) << conf << " ";
		//System.out.println("Display string result with probability " + prob + " and conf of " + conf );
	  for(int i = 0; i < nitems; i++) 
		  System.out.print(" " + items[i]);
	  System.out.println("");
	  return;
	}

	public void display(StringSet lits, int prob_comp)
	{
	  int i, j;
	  ArrayString lstr;

	  //fp << setw(6) << prob_comp * prob << " " << setw(6) << conf << " ";
	  for(i = 0; i < nitems; i++) 
	    {
	      //fp << "  << ";
	      lstr = lits.get_pat(items[i]);

	      for (j = 0; j < lstr.nitems; j++) 
	    	  System.out.println("*+* " + lstr.items[j]);
			//fp << lstr->items[j] << " ";

	      //fp << ">>";
	    }
	  //fp << endl;
	  return;
	}
}
